package domd4;

import java.util.Scanner;
public class test {
        public static int getArrayValue (int[] array, int index) {
            if (array == null) {
                throw new NullPointerException("getArrayValue::传递的数组为空");
            }
            if (index < 0 || index >= array.length) {
                throw new ArrayIndexOutOfBoundsException("getArrayValue::数组下标越界了！");
            }
            System.out.println("测试抛出异常后会不会执行后续代码！");
            return array[index];
        }

        public static void main(String[] args) {
            int[] array = {1,2,3,4,5};
            int ret = getArrayValue(array, 10);
            System.out.println(ret);
        }
}
